package com.huanbao.oil.app;

import android.util.Log;

import org.junit.Test;

import java.text.DecimalFormat;

import static org.junit.Assert.*;

public class Test1Test {

    @Test
    public void test1() {
        double a=2.34998828;
        String  b="98766.567";
        Log.d("tag",keepOneByStr(b));

    }
    public static String keepOneByStr(String v) {
        double a=Double.valueOf(v);
        DecimalFormat df2 = new DecimalFormat("0.0");//保留2�?
        return df2.format(a);
    }
}